home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Sound / GSMToast / src / Makefile next >
Encoding:
Makefile  |  1997-03-10  |  12.5 KB  |  494 lines

  1. # Copyright 1992-1996 by Jutta Degener and Carsten Bormann, Technische
  2. # Universitaet Berlin.  See the accompanying file "COPYRIGHT" for
  3. # details.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
  4.  
  5. # Machine- or installation dependent flags you should configure to port
  6.  
  7. SASR    = -DSASR
  8. ######### Define SASR if >> is a signed arithmetic shift (-1 >> 1 == -1)
  9.  
  10. # MULHACK = -DUSE_FLOAT_MUL
  11. ######### Define this if your host multiplies floats faster than integers,
  12. ######### e.g. on a SPARCstation.
  13.  
  14. # FAST    = -DFAST
  15. ######### Define together with USE_FLOAT_MUL to enable the GSM library's
  16. ######### approximation option for incorrect, but good-enough results.
  17.  
  18. # LTP_CUT       = -DLTP_CUT
  19. LTP_CUT =
  20. ######### Define to enable the GSM library's long-term correlation 
  21. ######### approximation option---faster, but worse; works for
  22. ######### both integer and floating point multiplications.
  23. ######### This flag is still in the experimental stage.
  24.  
  25. #WAV49  = -DWAV49
  26. WAV49   =
  27. ######### Define to enable the GSM library's option to pack GSM frames 
  28. ######### in the style used by the WAV #49 format.  If you want to write
  29. ######### a tool that produces .WAV files which contain GSM-encoded data,
  30. ######### define this, and read about the GSM_OPT_WAV49 option in the
  31. ######### manual page on gsm_option(3).
  32.  
  33. # Choose a compiler.  The code works both with ANSI and K&R-C.
  34. # Use -DNeedFunctionPrototypes to compile with, -UNeedFunctionPrototypes to
  35. # compile without, function prototypes in the header files.
  36. #
  37. # You can use the -DSTUPID_COMPILER to circumvent some compilers'
  38. # static limits regarding the number of subexpressions in a statement.
  39.  
  40. # CC            = cc
  41. # CCFLAGS       = -c -DSTUPID_COMPILER
  42.  
  43. # CC            = /usr/lang/acc
  44. # CCFLAGS       = -c -O
  45.  
  46. CC              = gcc -ansi -pedantic
  47. CCFLAGS         = -c -O2 -DNeedFunctionPrototypes=1 -m68020 -funroll-loops -mstackextend -DAMIGA
  48.  
  49. LD              = $(CC)
  50.  
  51. # LD            = gcc
  52. # LDFLAGS       =
  53.  
  54.  
  55. # If your compiler needs additional flags/libraries, regardless of
  56. # the source compiled, configure them here.
  57.  
  58. # CCINC = -I/usr/gnu/lib/gcc-2.1/gcc-lib/sparc-sun-sunos4.1.2/2.1/include
  59. ######### Includes needed by $(CC)
  60.  
  61. # LDINC = -L/usr/gnu/lib/gcc-2.1/gcc-lib/sparc-sun-sunos4.1.2/2.1
  62. ######### Library paths needed by $(LD)
  63.  
  64. # LDLIB = -lgcc
  65. ######### Additional libraries needed by $(LD)
  66.  
  67. # Where do you want to install libraries, binaries, a header file
  68. # and the manual pages?
  69. #
  70. # Leave INSTALL_ROOT empty (or just don't execute "make install") to
  71. # not install gsm and toast outside of this directory.
  72.  
  73. INSTALL_ROOT    =
  74.  
  75. # Where do you want to install the gsm library, header file, and manpages?
  76. #
  77. # Leave GSM_INSTALL_ROOT empty to not install the GSM library outside of
  78. # this directory.
  79.  
  80. GSM_INSTALL_ROOT = $(INSTALL_ROOT)
  81. GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
  82. GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc
  83. GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
  84.  
  85.  
  86. # Where do you want to install the toast binaries and their manpage?
  87. #
  88. # Leave TOAST_INSTALL_ROOT empty to not install the toast binaries outside
  89. # of this directory.
  90.  
  91. TOAST_INSTALL_ROOT        = $(INSTALL_ROOT)
  92. TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin
  93. TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1
  94.  
  95. #  Other tools
  96.  
  97. SHELL           = /bin/sh
  98. LN              = ln
  99. BASENAME        = basename
  100. AR              = ar
  101. ARFLAGS         = cr
  102. RMFLAGS         =
  103. FIND            = find
  104. COMPRESS        = compress
  105. COMPRESSFLAGS   = 
  106. # RANLIB        = true
  107. RANLIB          = ranlib
  108.  
  109. #
  110. #    You shouldn't have to configure below this line if you're porting.
  111.  
  112.  
  113. # Local Directories
  114.  
  115. ROOT    = .
  116. ADDTST  = $(ROOT)/add-test
  117. TST     = $(ROOT)/tst
  118. MAN     = $(ROOT)/man
  119. BIN     = $(ROOT)/bin
  120. SRC     = $(ROOT)/src
  121. LIB     = $(ROOT)/lib
  122. TLS     = $(ROOT)/tls
  123. INC     = $(ROOT)/inc
  124.  
  125. # Flags
  126.  
  127. # DEBUG = -DNDEBUG
  128. ######### Remove -DNDEBUG to enable assertions.
  129.  
  130. CFLAGS  = $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \
  131.     $(WAV49) $(CCINC) -I$(INC)
  132. ######### It's $(CC) $(CFLAGS)
  133.  
  134. LFLAGS  = $(LDFLAGS) $(LDINC)
  135. ######### It's $(LD) $(LFLAGS)
  136.  
  137.  
  138. # Targets
  139.  
  140. LIBGSM  = $(LIB)/libgsm.a
  141.  
  142. TOAST   = $(BIN)/toast
  143. UNTOAST = $(BIN)/untoast
  144. TCAT    = $(BIN)/tcat
  145.  
  146. # Headers
  147.  
  148. GSM_HEADERS =   $(INC)/gsm.h
  149.  
  150. HEADERS =       $(INC)/proto.h          \
  151.         $(INC)/unproto.h        \
  152.         $(INC)/config.h         \
  153.         $(INC)/private.h        \
  154.         $(INC)/gsm.h            \
  155.         $(INC)/toast.h          \
  156.         $(TLS)/taste.h
  157.  
  158. # Sources
  159.  
  160. GSM_SOURCES =   $(SRC)/add.c            \
  161.         $(SRC)/code.c           \
  162.         $(SRC)/debug.c          \
  163.         $(SRC)/decode.c         \
  164.         $(SRC)/long_term.c      \
  165.         $(SRC)/lpc.c            \
  166.         $(SRC)/preprocess.c     \
  167.         $(SRC)/rpe.c            \
  168.         $(SRC)/gsm_destroy.c    \
  169.         $(SRC)/gsm_decode.c     \
  170.         $(SRC)/gsm_encode.c     \
  171.         $(SRC)/gsm_explode.c    \
  172.         $(SRC)/gsm_implode.c    \
  173.         $(SRC)/gsm_create.c     \
  174.         $(SRC)/gsm_print.c      \
  175.         $(SRC)/gsm_option.c     \
  176.         $(SRC)/short_term.c     \
  177.         $(SRC)/table.c
  178.  
  179. TOAST_SOURCES = $(SRC)/toast.c          \
  180.         $(SRC)/toast_lin.c      \
  181.         $(SRC)/toast_ulaw.c     \
  182.         $(SRC)/toast_alaw.c     \
  183.         $(SRC)/toast_audio.c
  184.  
  185. SOURCES =       $(GSM_SOURCES)          \
  186.         $(TOAST_SOURCES)        \
  187.         $(ADDTST)/add_test.c    \
  188.         $(TLS)/sour.c           \
  189.         $(TLS)/ginger.c         \
  190.         $(TLS)/sour1.dta        \
  191.         $(TLS)/sour2.dta        \
  192.         $(TLS)/bitter.c         \
  193.         $(TLS)/bitter.dta       \
  194.         $(TLS)/taste.c          \
  195.         $(TLS)/sweet.c          \
  196.         $(TST)/cod2lin.c        \
  197.         $(TST)/cod2txt.c        \
  198.         $(TST)/gsm2cod.c        \
  199.         $(TST)/lin2cod.c        \
  200.         $(TST)/lin2txt.c
  201.  
  202. # Object files
  203.  
  204. GSM_OBJECTS =   $(SRC)/add.o            \
  205.         $(SRC)/code.o           \
  206.         $(SRC)/debug.o          \
  207.         $(SRC)/decode.o         \
  208.         $(SRC)/long_term.o      \
  209.         $(SRC)/lpc.o            \
  210.         $(SRC)/preprocess.o     \
  211.         $(SRC)/rpe.o            \
  212.         $(SRC)/gsm_destroy.o    \
  213.         $(SRC)/gsm_decode.o     \
  214.         $(SRC)/gsm_encode.o     \
  215.         $(SRC)/gsm_explode.o    \
  216.         $(SRC)/gsm_implode.o    \
  217.         $(SRC)/gsm_create.o     \
  218.         $(SRC)/gsm_print.o      \
  219.         $(SRC)/gsm_option.o     \
  220.         $(SRC)/short_term.o     \
  221.         $(SRC)/table.o
  222.  
  223. TOAST_OBJECTS = $(SRC)/toast.o          \
  224.         $(SRC)/toast_lin.o      \
  225.         $(SRC)/toast_ulaw.o     \
  226.         $(SRC)/toast_alaw.o     \
  227.         $(SRC)/toast_audio.o
  228.  
  229. OBJECTS =        $(GSM_OBJECTS) $(TOAST_OBJECTS)
  230.  
  231. # Manuals
  232.  
  233. GSM_MANUALS =   $(MAN)/gsm.3            \
  234.         $(MAN)/gsm_explode.3    \
  235.         $(MAN)/gsm_option.3     \
  236.         $(MAN)/gsm_print.3
  237.  
  238. TOAST_MANUALS = $(MAN)/toast.1
  239.  
  240. MANUALS =       $(GSM_MANUALS) $(TOAST_MANUALS) $(MAN)/bitter.1
  241.  
  242. # Other stuff in the distribution
  243.  
  244. STUFF =         ChangeLog                       \
  245.         INSTALL                 \
  246.         MACHINES                \
  247.         MANIFEST                \
  248.         Makefile                \
  249.         README                  \
  250.         $(ADDTST)/add_test.dta  \
  251.         $(TLS)/bitter.dta       \
  252.         $(TST)/run
  253.  
  254.  
  255. # Install targets
  256.  
  257. GSM_INSTALL_TARGETS =   \
  258.         $(GSM_INSTALL_LIB)/libgsm.a             \
  259.         $(GSM_INSTALL_INC)/gsm.h                \
  260.         $(GSM_INSTALL_MAN)/gsm.3                \
  261.         $(GSM_INSTALL_MAN)/gsm_explode.3        \
  262.         $(GSM_INSTALL_MAN)/gsm_option.3         \
  263.         $(GSM_INSTALL_MAN)/gsm_print.3
  264.  
  265. TOAST_INSTALL_TARGETS = \
  266.         $(TOAST_INSTALL_BIN)/toast              \
  267.         $(TOAST_INSTALL_BIN)/tcat               \
  268.         $(TOAST_INSTALL_BIN)/untoast            \
  269.         $(TOAST_INSTALL_MAN)/toast.1
  270.  
  271.  
  272. # Default rules
  273.  
  274. .c.o:
  275.         $(CC) $(CFLAGS) $?
  276.         @-mv `$(BASENAME) $@` $@ > /dev/null 2>&1
  277.  
  278. # Target rules
  279.  
  280. all:            $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
  281.         @-echo $(ROOT): Done.
  282.  
  283. tst:            $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
  284.         @-echo tst: Done.
  285.  
  286. addtst:         $(ADDTST)/add $(ADDTST)/add_test.dta
  287.         $(ADDTST)/add < $(ADDTST)/add_test.dta > /dev/null
  288.         @-echo addtst: Done.
  289.  
  290. misc:           $(TLS)/sweet $(TLS)/bitter $(TLS)/sour $(TLS)/ginger    \
  291.             $(TST)/lin2txt $(TST)/cod2txt $(TST)/gsm2cod
  292.         @-echo misc: Done.
  293.  
  294. install:        toastinstall gsminstall
  295.         @-echo install: Done.
  296.  
  297.  
  298. # The basic API: libgsm
  299.  
  300. $(LIBGSM):      $(LIB) $(GSM_OBJECTS)
  301.         -rm $(RMFLAGS) $(LIBGSM)
  302.         $(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
  303.         $(RANLIB) $(LIBGSM)
  304.  
  305.  
  306. # Toast, Untoast and Tcat -- the compress-like frontends to gsm.
  307.  
  308. $(TOAST):       $(BIN) $(TOAST_OBJECTS) $(LIBGSM)
  309.         $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
  310.  
  311. $(UNTOAST):     $(BIN) $(TOAST)
  312.         -rm $(RMFLAGS) $(UNTOAST)
  313.         $(LN) $(TOAST) $(UNTOAST)
  314.  
  315. $(TCAT):        $(BIN) $(TOAST)
  316.         -rm $(RMFLAGS) $(TCAT)
  317.         $(LN) $(TOAST) $(TCAT)
  318.  
  319.  
  320. # The local bin and lib directories
  321.  
  322. $(BIN):
  323.         if [ ! -d $(BIN) ] ; then mkdir $(BIN) ; fi
  324.  
  325. $(LIB):
  326.         if [ ! -d $(LIB) ] ; then mkdir $(LIB) ; fi
  327.  
  328.  
  329. # Installation
  330.  
  331. gsminstall:
  332.         -if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then      \
  333.             make $(GSM_INSTALL_TARGETS) ;   \
  334.         fi
  335.  
  336. toastinstall:
  337.         -if [ x"$(TOAST_INSTALL_ROOT)" != x ]; then     \
  338.             make $(TOAST_INSTALL_TARGETS);  \
  339.         fi
  340.  
  341. gsmuninstall:
  342.         -if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then      \
  343.             rm $(RMFLAGS) $(GSM_INSTALL_TARGETS) ;  \
  344.         fi
  345.  
  346. toastuninstall:
  347.         -if [ x"$(TOAST_INSTALL_ROOT)" != x ] ; then    \
  348.             rm $(RMFLAGS) $(TOAST_INSTALL_TARGETS); \
  349.         fi
  350.  
  351. $(TOAST_INSTALL_BIN)/toast:     $(TOAST)
  352.         -rm $@
  353.         cp $(TOAST) $@
  354.         chmod 755 $@
  355.  
  356. $(TOAST_INSTALL_BIN)/untoast:   $(TOAST_INSTALL_BIN)/toast
  357.         -rm $@
  358.         ln $? $@
  359.  
  360. $(TOAST_INSTALL_BIN)/tcat:      $(TOAST_INSTALL_BIN)/toast
  361.         -rm $@
  362.         ln $? $@
  363.  
  364. $(TOAST_INSTALL_MAN)/toast.1:   $(MAN)/toast.1
  365.         -rm $@
  366.         cp $? $@
  367.         chmod 444 $@
  368.  
  369. $(GSM_INSTALL_MAN)/gsm.3:       $(MAN)/gsm.3
  370.         -rm $@
  371.         cp $? $@
  372.         chmod 444 $@
  373.  
  374. $(GSM_INSTALL_MAN)/gsm_option.3:        $(MAN)/gsm_option.3
  375.         -rm $@
  376.         cp $? $@
  377.         chmod 444 $@
  378.  
  379. $(GSM_INSTALL_MAN)/gsm_explode.3:       $(MAN)/gsm_explode.3
  380.         -rm $@
  381.         cp $? $@
  382.         chmod 444 $@
  383.  
  384. $(GSM_INSTALL_MAN)/gsm_print.3: $(MAN)/gsm_print.3
  385.         -rm $@
  386.         cp $? $@
  387.         chmod 444 $@
  388.  
  389. $(GSM_INSTALL_INC)/gsm.h:       $(INC)/gsm.h
  390.         -rm $@
  391.         cp $? $@
  392.         chmod 444 $@
  393.  
  394. $(GSM_INSTALL_LIB)/libgsm.a:    $(LIBGSM)
  395.         -rm $@
  396.         cp $? $@
  397.         chmod 444 $@
  398.  
  399.  
  400. # Distribution
  401.  
  402. dist:           gsm-1.0.tar.Z
  403.         @echo dist: Done.
  404.  
  405. gsm-1.0.tar.Z:  $(STUFF) $(SOURCES) $(HEADERS) $(MANUALS)
  406.         (       cd $(ROOT)/..;                          \
  407.             tar cvf - `cat $(ROOT)/gsm-1.0/MANIFEST \
  408.                 | sed '/^#/d'`                  \
  409.         ) | $(COMPRESS) $(COMPRESSFLAGS) > $(ROOT)/gsm-1.0.tar.Z
  410.  
  411. # Clean
  412.  
  413. uninstall:      toastuninstall gsmuninstall
  414.         @-echo uninstall: Done.
  415.  
  416. semi-clean:
  417.         -rm $(RMFLAGS)  */*.o                   \
  418.             $(TST)/lin2cod $(TST)/lin2txt   \
  419.             $(TST)/cod2lin $(TST)/cod2txt   \
  420.             $(TST)/gsm2cod                  \
  421.             $(TST)/*.*.*
  422.         -$(FIND) . \( -name core -o -name foo \) \
  423.             -print | xargs rm $(RMFLAGS)
  424.  
  425. clean:  semi-clean
  426.         -rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add          \
  427.             $(TOAST) $(TCAT) $(UNTOAST)     \
  428.             $(ROOT)/gsm-1.0.tar.Z
  429.  
  430.  
  431. # Two tools that helped me generate gsm_encode.c and gsm_decode.c,
  432. # but aren't generally needed to port this.
  433.  
  434. $(TLS)/sweet:   $(TLS)/sweet.o $(TLS)/taste.o
  435.         $(LD) $(LFLAGS) -o $(TLS)/sweet \
  436.             $(TLS)/sweet.o $(TLS)/taste.o $(LDLIB)
  437.  
  438. $(TLS)/bitter:  $(TLS)/bitter.o $(TLS)/taste.o
  439.         $(LD) $(LFLAGS) -o $(TLS)/bitter \
  440.             $(TLS)/bitter.o $(TLS)/taste.o $(LDLIB)
  441.  
  442. # A version of the same family that Jeff Chilton used to implement
  443. # the WAV #49 GSM format.
  444.  
  445. $(TLS)/ginger:  $(TLS)/ginger.o $(TLS)/taste.o
  446.         $(LD) $(LFLAGS) -o $(TLS)/ginger \
  447.             $(TLS)/ginger.o $(TLS)/taste.o $(LDLIB)
  448.  
  449. $(TLS)/sour:    $(TLS)/sour.o $(TLS)/taste.o
  450.         $(LD) $(LFLAGS) -o $(TLS)/sour \
  451.             $(TLS)/sour.o $(TLS)/taste.o $(LDLIB)
  452.  
  453. # Run $(ADDTST)/add < $(ADDTST)/add_test.dta to make sure the
  454. # basic arithmetic functions work as intended.
  455.  
  456. $(ADDTST)/add:  $(ADDTST)/add_test.o
  457.         $(LD) $(LFLAGS) -o $(ADDTST)/add $(ADDTST)/add_test.o $(LDLIB)
  458.  
  459.  
  460. # Various conversion programs between linear, text, .gsm and the code
  461. # format used by the tests we ran (.cod).  We paid for the test data,
  462. # so I guess we can't just provide them with this package.  Still,
  463. # if you happen to have them lying around, here's the code.
  464. # You can use gsm2cod | cod2txt independently to look at what's
  465. # coded inside the compressed frames, although this shouldn't be
  466. # hard to roll on your own using the gsm_print() function from
  467. # the API.
  468.  
  469.  
  470. $(TST)/test-result:     $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/run
  471.             ( cd $(TST); ./run ) 
  472.  
  473. $(TST)/lin2txt:         $(TST)/lin2txt.o $(LIBGSM)
  474.             $(LD) $(LFLAGS) -o $(TST)/lin2txt \
  475.                 $(TST)/lin2txt.o $(LIBGSM) $(LDLIB)
  476.  
  477. $(TST)/lin2cod:         $(TST)/lin2cod.o $(LIBGSM)
  478.             $(LD) $(LFLAGS) -o $(TST)/lin2cod \
  479.                 $(TST)/lin2cod.o $(LIBGSM) $(LDLIB)
  480.  
  481. $(TST)/gsm2cod:         $(TST)/gsm2cod.o $(LIBGSM)
  482.             $(LD) $(LFLAGS) -o $(TST)/gsm2cod \
  483.                 $(TST)/gsm2cod.o $(LIBGSM) $(LDLIB)
  484.  
  485. $(TST)/cod2txt:         $(TST)/cod2txt.o $(LIBGSM)
  486.             $(LD) $(LFLAGS) -o $(TST)/cod2txt \
  487.                 $(TST)/cod2txt.o $(LIBGSM) $(LDLIB)
  488.  
  489. $(TST)/cod2lin:         $(TST)/cod2lin.o $(LIBGSM)
  490.             $(LD) $(LFLAGS) -o $(TST)/cod2lin \
  491.                 $(TST)/cod2lin.o $(LIBGSM) $(LDLIB)
  492.